The present application relates to a communication apparatus, a communication method, and a program. Particularly, the present application relates a communication apparatus, a communication method, and a program that enables a reader/writer communicating with an IC (integrated circuit) card in a noncontact manner to easily communicate with the IC card even if interference occurs between the reader/writer and another reader/writer.
Recently, a noncontact IC card system, in which an IC card and a reader/writer communicate with each other in a noncontact manner through electromagnetic waves, has rapidly become widespread.
In the noncontact IC card system, a reader/writer outputs electromagnetic waves. When an IC card is held over the reader/writer, the IC card operates by obtaining power from mutual induction caused by the electromagnetic waves output from the reader/writer and starts communication with the reader/writer. The reader/writer transmits data to the IC card by modulating electromagnetic waves output therefrom. On the other hand, the IC card transmits data to the reader/writer by modulating non-modulated electromagnetic waves output from the reader/writer by so-called load modulation.
As described above, in the noncontact IC card system, the IC card and the reader/writer communicate with each other in a noncontact manner. This system is highly convenient and is now widely used in, for example, automatic ticket gates in stations.
The automatic ticket gates are required to deal with entrance/exit of many people in short time and thus are required to be provided with many readers/writers. However, readers/writers functioning as automatic ticket gates are placed in a limited space of a gate of a station. If many readers/writers are to be placed, the readers/writers are inevitably close to each other.
In such a case where readers/writers are close to each other, if the readers/writers use carrier waves of the same frequency, electromagnetic waves output from the readers/writers cause mutual interference, so that the readers/writers may not be able to communicate with an IC card held thereover.
FIG. 1 shows a state where a plurality of readers/writers are causing interference.
In FIG. 1, an IC card C is held over a reader/writer A, and thus the reader/writer A should communicate with only the IC card C.
However, if another reader/writer B exists close to the reader/writer A, as shown in FIG. 1, electromagnetic waves output from the reader/writer A and those output from the reader/writer B cause mutual interference, and as a result, the electromagnetic waves that caused mutual interference are received by the reader/writer A as electromagnetic waves that are load-modulated by the IC card C. Accordingly, the communication between the reader/writer A and the IC card C is interfered.
In order to prevent such interference of communication between the reader/writer A and the IC card C, a first method is suggested. In the first method, the readers/writers A and B are placed with a predetermined distance therebetween so that the electromagnetic waves output therefrom do not cause mutual interference.
In the first method, however, the number of readers/writers that can be placed in a gate reduces. As a result, it becomes difficult to deal with entrance/exit of many people in short time.
There are also suggested a second method of providing an interference detecting unit to detect interference in a reader/writer so that data communication is not performed while interference is caused (e.g., see Japanese Unexamined Patent Invention Publication No. 10-293824); a third method of inverting the phase of a radiation field between adjacent readers/writers (e.g., see Japanese Unexamined Patent Invention Publication No. 11-345294); and a fourth method of providing a function to change the frequency of carrier waves in a reader/writer (e.g., see Japanese Unexamined Patent Invention Publication No. 2000-20651).
However, in the second method, a hardware device serving as the interference detecting unit needs to be provided in the reader/writer, which increases the cost of the reader/writer.
In the third method of inverting the phase of a radiation field between adjacent readers/writers, a hardware device to invert the phase needs to be provided. Further, in the third method, a setter needs to set readers/writers by designing the setting positions thereof so as to satisfy a setting condition in which the radiation field is absolutely inverted in adjacent readers/writers, which is inconvenient.
In the fourth method, a setter of readers/writers needs to manage the frequency of carrier waves of the readers/writers. Particularly, a heavy load is imposed on the setter when a reader/writer is added or when the positions of the readers/writers are changed.
Further, a fifth method is suggested. In the fifth method, if a reception error occurs, that is, if a reader/writer cannot receive a correct response packet from an IC card, the reader/writer retransmits a command packet to the IC card (make a retry to transmit the command packet).
More specifically, packets are transmitted/received through noncontact communication between a reader/writer and an IC card constituting a noncontact IC card system. The reader/writer transmits a command packet, which is a packet including information of a command to execute a predetermined process, to the IC card. The IC card transmits a response packet, which is a packet including a response to the command packet from the reader/writer, to the reader/writer.
In the fifth method, the reader/writer transmits a command packet, waits for and receives a packet (response packet), and checks whether the packet has an error. If the packet received by the reader/writer has an error, the reader/writer immediately retransmits the command packet. After that, the reader/writer repeats receiving a packet (response packet), error check of the packet, and retransmission of the command packet until receiving a correct response packet from the IC card.
The fifth method is effective for the interference caused in the following example. For example, an IC card exists near an IC card held over a reader/writer. Under this condition, both IC cards react to a command packet transmitted from the reader/writer and transmit response packets to the command packet, which causes interference.
However, when interference is caused between the two readers/writers A and B close to each other, as described above with reference to FIG. 1, the communication performance between the reader/writer A and the IC card C held thereover cannot always be improved by the fifth method of retransmitting a command packet. Rather, the communication performance may degrade.
FIGS. 2 and 3 show the operations of the readers/writers A and B and the IC card C performed when the IC card C is held over the reader/writer A among the two readers/writers A and B close to each other.
Referring to FIG. 2, the reader/writer A transmits a command packet PA1 having a command code of 0x10 (“0x” indicates that the character (string) following thereafter is a hexadecimal number) in step S1. Then, the process proceeds to step S2, where the reader/writer A enters a reception waiting state to wait for receiving a response packet to the command packet PA1.
Each packet transmitted/received between the reader/writer A or B and the IC card C includes a command code or a response code representing the type of the packet. The command code or the response code indicates that the packet is a command packet or a response packet.
In FIG. 2, the reader/writer A transmits the command packet PA1 having a command code of 0x10 in step S1. Assuming that a response code of a response packet to the command packet having the command code 0x10 is 0x11, for example, the reader/writer A waits for receiving a packet (response packet) having a response code of 0x11 in the reception waiting state in step S2.
On the other hand, the IC card C receives the command packet PA1 having the command code 0x10 transmitted from the reader/writer A and starts a process in accordance with the command packet PA1 in step S11. After performing the process in accordance with the command packet PA1 from the reader/writer A, the IC card C transmits a response packet having a response code of 0x11 in response to the command packet PA1.
On the other hand, the reader/writer B performs polling to detect that an IC card is held thereover (that an IC card exists at a nearby position). Specifically, the reader/writer B periodically transmits a command packet having a command code of 0x80.
In FIG. 2, the reader/writer B transmits a command packet PB1 having the command code 0x80 in step S21. Further, the reader/writer B periodically transmits a command packet having the command code 0x80.
When the reader/writer B transmits the packet PB1 in step S21, the reader/writer A is in the reception waiting state in step S2 and thus receives the packet PB1 from the reader/writer B in step S3.
However, the packet PB1 from the reader/writer B is a command packet having the command code 0x80 and is not a response packet to the command packet PA1 to be received, that is, a packet having the response code 0x11. Therefore, the reader/writer A determines that the packet PB1 received in step S3 has an error and retransmits the command packet in step S4. In other words, the reader/writer A transmits a command packet PA2 having the command code 0x10.
In this case, if the IC card C transmits a response packet to the command packet PA1 while the reader/writer A is retransmitting the command packet having the command code 0x10, the reader/writer A cannot receive the response packet from the IC card C.
A packet transmitted between a reader/writer and an IC card constituting a noncontact IC card system may include a sequence ID (identification). The sequence ID is a value that is incremented by one by authorized reader/writer and IC card in order to prevent so-called masquerading, in which an unauthorized reader/writer or IC card interrupts the communication performed by the authorized reader/writer and IC card and masquerades as an authorized reader/writer or IC card.
FIG. 3 shows the operations of the readers/writers A and B and the IC card C in a case where packets including a sequence ID are transmitted between the reader/writer A or B and the IC card C.
In step S31, the reader/writer A transmits a packet (command packet) PA1 having a sequence ID of 11 and enters a reception waiting state to wait for receiving a response packet to the command packet PA1, as in the case shown in FIG. 2.
In step S41, the IC card C held over the reader/writer A receives the packet PA1 from the reader/writer A and starts a process in accordance with the packet PA1.
On the other hand, the reader/writer B performs polling as in FIG. 2. In FIG. 3, the reader/writer B transmits a packet (command packet) PB in step S51.
When the reader/writer B transmits the packet PB in step S51, the reader/writer A is in the reception waiting state. Then, in step S32, the reader/writer A receives the packet PB from the reader/writer B.
The packet PB from the reader/writer B is a command packet and is not a response packet to the command packet PA1 to be received by the reader/writer A.
Therefore, as in FIG. 2, the reader/writer A determines that the packet PB received in step S32 has an error, and retransmits a packet (command packet) in step S33. That is, the reader/writer A transmits a packet PA2 as a retransmission of the packet PA1.
At this time, the reader/writer A increments the sequence ID by one. Specifically, since the sequence ID of the previously transmitted packet PA1 is 11, the sequence ID of the packet PA2 is set to 12.
In step S42, the IC card C receives the packet PA2 from the reader/writer A.
After the IC card C completes the process in accordance with the packet PA1 including the sequence ID 11 received in step S41, the IC card C transmits a packet PC in response to the packet PA1 in step S43.
The packet PC is a response packet to the packet PA1 including the sequence ID 11 from the reader/writer A. Therefore, the IC card C increments the sequence ID of the packet PC by one into 12.
In step S34, the reader/writer A receives the packet PC from the IC card C. However, the sequence ID of this packet PC is 12, which is not a value (13) generated by incrementing the sequence ID 12 of the packet PA2 that was previously transmitted by the reader/writer A by one.
Therefore, the reader/writer A determines that the packet PC received in step S34 has an error (in this case, the packet PC is determined to be an incorrect packet), and retransmits a packet in step S35. That is, the reader/writer A transmits a packet PA3 as a retransmission of the packet PA1.
At this time, since the sequence ID of the previously transmitted packet PA2 is 12, the reader/writer A sets the sequence ID of the packet PA3 to 13 by incrementing 12 by one.
The packet PC that is received by the reader/writer A in step S34 is a correct response packet to the packet PA1 that is transmitted by the reader/writer A in step S31. However, the packet PC is transmitted from the IC card C after the reader/writer A transmitted the packet PA2 in step S33 as a retransmission of the packet PA1. Therefore, the reader/writer A regards the response packet PC, which is a correct response packet to the packet PA1, as an incorrect response packet to the packet PA2, determines that an error has occurred, and retransmits the command packet.
As described above, if the reader/writer A retransmits a packet immediately after detecting an error in a received packet, retransmission of the packet frequently occurs every time an error is detected in a packet received by the reader/writer A due to interference caused between the readers/writers A and B. This interferes with the communication between the reader/writer A and the IC card C held thereover. Accordingly, the communication performance (responsibility of the IC card C) degrades, which results in a decrease in the reliability of the entire noncontact IC card system.